package com.ty.day4;

import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/9 15:19
 */
public class Five {
    public static void main(String[] args) {
        int result = 123456;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入开门密码：");
        int x, count = 0;
        do {
            x = sc.nextInt();
            count++;
            if (x == result) {
                System.out.println("欢迎业主回家！！");
                break;
            }
            if(count<=3){
                System.out.println(count+"次密码错误");
            }else {
                System.out.println("都"+count+"次了，你是小偷吧，连密码都不知道吗？");
            }
            System.out.print("再来：");
        } while (true);
        System.out.println("厉害只猜了" + count + "次");
    }
}
